package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.request.DictTreeDeleteParam;
import com.ysd.lis.request.DictTreeItemAddParam;
import com.ysd.lis.request.DictTreeTypeAddParam;
import com.ysd.lis.service.TDictTreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * cold_chain.t_menu 前端控制器
 * </p>
 *
 * @author Peng
 * @since 2021-10-12
 */
@RestController
public class TDictTreeController extends BaseController {
    @Autowired
    TDictTreeService tDictTreeService;
    @GetMapping("/api/sys/findDictReportFieldList")
        public Result findDictReportFieldList(){
        return tDictTreeService.findDictReportFieldList();
    }
    @GetMapping("/api/sys/findDictReportValueList")
    public Result findDictReportValueList(@RequestParam String typeId,@RequestParam Integer pageSize,@RequestParam Integer pageIndex){
        return tDictTreeService.findDictReportValueList(typeId,pageSize,pageIndex);
    }
    @PostMapping("/api/sys/addDictReportField")
    public Result addDictReportField(@RequestBody DictTreeTypeAddParam dictTreeTypeAddParam){
        return tDictTreeService.addDictReportField(dictTreeTypeAddParam);
    }
    @PostMapping("/api/sys/editDictReportField")
    public Result editDictReportField(@RequestBody DictTreeTypeAddParam dictTreeTypeAddParam){
        return tDictTreeService.editDictReportField(dictTreeTypeAddParam);
    }
    @PostMapping("/api/sys/deleteDictReportField")
    public Result deleteDictReportField(@RequestBody DictTreeDeleteParam dictTreeDeleteParam){
        return tDictTreeService.deleteDictReportField(dictTreeDeleteParam.getId());
    }
    @PostMapping("api/sys/addDictReportValue")
    public Result addDictReportValue(@RequestBody DictTreeItemAddParam dictTreeItemAddParam){
        return tDictTreeService.addDictReportValue(dictTreeItemAddParam);
    }
    @PostMapping("api/sys/editDictReportValue")
    public Result editDictReportValue(@RequestBody DictTreeItemAddParam dictTreeItemAddParam){
        return tDictTreeService.editDictReportValue(dictTreeItemAddParam);
    }
    @PostMapping("/api/sys/deleteDictReportValue")
    public Result deleteDictReportValue(@RequestBody DictTreeDeleteParam dictTreeDeleteParam){
        return tDictTreeService.deleteDictReportValue(dictTreeDeleteParam.getId());
    }

    @GetMapping("/api/sys/getDictValueByType")
    public Result getDictValueByType(@RequestParam String code){
        return tDictTreeService.getDictValueByType(code);
    }
    @GetMapping("/api/sys/getDictValueByTypes")
    public Result getDictValueByTypes(@RequestParam String code){
        return tDictTreeService.getDictValueByTypes(code);
    }

    @GetMapping("/api/sys/getDictTreeTypeByOrgId")
    public Result getDictTreeTypeByOrgId(String orgId){
        return tDictTreeService.getDictTreeTypeByOrgId(orgId);
    }
}
